package com.zhuss.controller.core;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.core.permission.CarePermissionResourceListBo;
import com.zhuss.bean.bo.core.permission.CarePermissionRoleListBo;
import com.zhuss.bean.bo.core.permission.DetailPermissionBo;
import com.zhuss.bean.bo.core.permission.ListPermissionTreeBo;
import com.zhuss.bean.bo.core.permission.SearchPermissionBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.ReadService;
import com.zhuss.core.permission.PermissionReadServiceExt;
import com.zhuss.exception.AabException;


/**
 * 权限点查询 controller
 * @Author zhushanshuo
   @Date 2019-11-27 19:58
 *
 */
  
 
@RestController
@RequestMapping("/permission")
public class PermissionReadController extends BaseController {
	
	@Autowired
	@Qualifier("permissionReadService")
	private ReadService<Object, Object> permissionReadService;
	
	@Autowired
	@Qualifier("permissionReadServiceExt")
	private PermissionReadServiceExt permissionReadServiceExt;
	
	/**
	 * 详情
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/detail")
    public Object detail(@RequestBody DetailPermissionBo bo) throws AabException {
		
		Object result = permissionReadService.detail(bo);
		return result;
    }
	
	/**
	 * 列表
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
    @RequestMapping("/list")
    public Object list(@RequestBody SearchPermissionBo bo) throws AabException {
		
		Object result = permissionReadService.list(bo);
		return result;
    }
	
	/**
	 * 权限树
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/listPermissionTree")
    public Object listPermissionTree(@RequestBody ListPermissionTreeBo bo) throws AabException {
		
		Object result = permissionReadServiceExt.listPermissionTree(bo);
		return result;
    }
	
	/**
	 * 查询权限的资源树
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/carePermissionResourceList")
    public Object carePermissionResourceList(@RequestBody CarePermissionResourceListBo bo) throws AabException {
		
		Object result = permissionReadServiceExt.carePermissionResourceList(bo);
		return result;
    }
	
	
	/**
	 * 查询权限的角色信息
	 * @param bo
	 * @return
	 * @throws AabException
	 */
	@ResponseBody
	@RequestMapping("/carePermissionRoleList")
    public Object carePermissionRoleList(@RequestBody CarePermissionRoleListBo bo) throws AabException {
		
		Object result = permissionReadServiceExt.carePermissionRoleList(bo);
		return result;
    }
	
	


	
}
